home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / wiz.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  27KB  |  710 lines

  1. /***************************************************************************
  2.  
  3. Wiz/Stinger/Scion memory map (preliminary)
  4.  
  5. Driver by Zsolt Vasvari
  6.  
  7.  
  8. These boards are similar to a Galaxian board in the way it handles scrolling
  9. and sprites, but the similarities pretty much end there. The most notable
  10. difference is that there are 2 independently scrollable playfields.
  11.  
  12.  
  13. Main CPU:
  14.  
  15. 0000-BFFF  ROM
  16. C000-C7FF  RAM
  17. D000-D3FF  Video RAM (Foreground)
  18. D400-D7FF  Color RAM (Foreground) (Wiz)
  19. D800-D83F  Attributes RAM (Foreground)
  20. D840-D85F  Sprite RAM 1
  21. E000-E3FF  Video RAM (Background)
  22. E400-E7FF  Color RAM (Background) (Wiz)
  23. E800-E83F  Attributes RAM (Background)
  24. E840-E85F  Sprite RAM 2
  25.  
  26. I/O read:
  27. f000 DIP SW#1
  28. f008 DIP SW#2
  29. f010 Input Port 1
  30. f018 Input Port 2
  31. f800 Watchdog
  32.  
  33. I/O write:
  34. c800 Coin Counter A
  35. c801 Coin Counter B
  36. f000 Sprite bank select (Wiz)
  37. f001 NMI enable
  38. f002 \ Palette select
  39. f003 /
  40. f004 \ Character bank select
  41. f005 /
  42. f006 \ Flip screen
  43. f007 /
  44. f800 Sound Command write
  45. f818 (?) Sound or Background color
  46.  
  47.  
  48. Sound CPU:
  49.  
  50. 0000-1FFF  ROM
  51. 2000-23FF  RAM
  52.  
  53. I/O read:
  54. 3000 Sound Command Read (Stinger/Scion)
  55. 7000 Sound Command Read (Wiz)
  56.  
  57. I/O write:
  58. 3000 NMI enable    (Stinger/Scion)
  59. 4000 AY8910 Control Port #1    (Wiz)
  60. 4001 AY8910 Write Port #1    (Wiz)
  61. 5000 AY8910 Control Port #2
  62. 5001 AY8910 Write Port #2
  63. 6000 AY8910 Control Port #3
  64. 6001 AY8910 Write Port #3
  65. 7000 NMI enable (Wiz)
  66.  
  67.  
  68. TODO:
  69.  
  70. - Verify/Fix colors
  71. - Sprite banking in Wiz. I have a hack in wiz_vh_screenrefresh
  72. - background noise in scion (but not scionc). Note that the sound program is
  73.   almost identical, except for three patches affecting noise period, noise
  74.   channel C enable and channel C volume. So it looks just like a bug in the
  75.   original (weird), or some strange form of protection.
  76.  
  77. ***************************************************************************/
  78.  
  79. #include "driver.h"
  80. #include "vidhrdw/generic.h"
  81.  
  82. extern unsigned char *wiz_videoram2;
  83. extern unsigned char *wiz_colorram2;
  84. extern unsigned char *wiz_attributesram;
  85. extern unsigned char *wiz_attributesram2;
  86. extern unsigned char *wiz_sprite_bank;
  87.  
  88. WRITE_HANDLER( wiz_char_bank_select_w );
  89. WRITE_HANDLER( wiz_attributes_w );
  90. WRITE_HANDLER( wiz_palettebank_w );
  91. void wiz_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  92. void wiz_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  93. void stinger_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  94. WRITE_HANDLER( wiz_flipx_w );
  95. WRITE_HANDLER( wiz_flipy_w );
  96.  
  97.  
  98. static WRITE_HANDLER( sound_command_w )
  99. {
  100.     if (data == 0x90)
  101.     {
  102.         /* ??? */
  103.     }
  104.     else
  105.         soundlatch_w(0,data);    /* ??? */
  106. }
  107.  
  108.  
  109. static struct MemoryReadAddress readmem[] =
  110. {
  111.     { 0x0000, 0xbfff, MRA_ROM },
  112.     { 0xc000, 0xc7ff, MRA_RAM },
  113.     { 0xd000, 0xd85f, MRA_RAM },
  114.     { 0xe000, 0xe85f, MRA_RAM },
  115.     { 0xf000, 0xf000, input_port_2_r },    /* DSW0 */
  116.     { 0xf008, 0xf008, input_port_3_r },    /* DSW1 */
  117.     { 0xf010, 0xf010, input_port_0_r },    /* IN0 */
  118.     { 0xf018, 0xf018, input_port_1_r },    /* IN1 */
  119.     { 0xf800, 0xf800, watchdog_reset_r },
  120.     { -1 }  /* end of table */
  121. };
  122.  
  123.  
  124. static struct MemoryWriteAddress writemem[] =
  125. {
  126.     { 0xc000, 0xc7ff, MWA_RAM },
  127.     { 0xc800, 0xc801, coin_counter_w },
  128.     { 0xd000, 0xd3ff, MWA_RAM, &wiz_videoram2 },
  129.     { 0xd400, 0xd7ff, MWA_RAM, &wiz_colorram2 },
  130.     { 0xd800, 0xd83f, MWA_RAM, &wiz_attributesram2 },
  131.     { 0xd840, 0xd85f, MWA_RAM, &spriteram_2, &spriteram_size },
  132.     { 0xe000, 0xe3ff, videoram_w, &videoram, &videoram_size },
  133.     { 0xe400, 0xe7ff, colorram_w, &colorram },
  134.     { 0xe800, 0xe83f, wiz_attributes_w, &wiz_attributesram },
  135.     { 0xe840, 0xe85f, MWA_RAM, &spriteram },
  136.     { 0xf000, 0xf000, MWA_RAM, &wiz_sprite_bank },
  137.     { 0xf001, 0xf001, interrupt_enable_w },
  138.     { 0xf002, 0xf003, wiz_palettebank_w },
  139.     { 0xf004, 0xf005, wiz_char_bank_select_w },
  140.     { 0xf006, 0xf006, wiz_flipx_w },
  141.     { 0xf007, 0xf007, wiz_flipy_w },
  142.     { 0xf800, 0xf800, sound_command_w },
  143.     { 0xf808, 0xf808, MWA_NOP },    /* explosion sound trigger; analog? */
  144.     { 0xf80a, 0xf80a, MWA_NOP },    /* shoot sound trigger; analog? */
  145.     { 0xf818, 0xf818, MWA_NOP },
  146.     { -1 }  /* end of table */
  147. };
  148.  
  149.  
  150. static struct MemoryReadAddress sound_readmem[] =
  151. {
  152.     { 0x0000, 0x1fff, MRA_ROM },
  153.     { 0x2000, 0x23ff, MRA_RAM },
  154.     { 0x3000, 0x3000, soundlatch_r },  /* Stinger/Scion */
  155.     { 0x7000, 0x7000, soundlatch_r },  /* Wiz */
  156.     { -1 }  /* end of table */
  157. };
  158.  
  159. static struct MemoryWriteAddress sound_writemem[] =
  160. {
  161.     { 0x2000, 0x23ff, MWA_RAM },
  162.     { 0x3000, 0x3000, interrupt_enable_w },        /* Stinger/Scion */
  163.     { 0x4000, 0x4000, AY8910_control_port_2_w },
  164.     { 0x4001, 0x4001, AY8910_write_port_2_w },
  165.     { 0x5000, 0x5000, AY8910_control_port_0_w },
  166.     { 0x5001, 0x5001, AY8910_write_port_0_w },
  167.     { 0x6000, 0x6000, AY8910_control_port_1_w },    /* Wiz only */
  168.     { 0x6001, 0x6001, AY8910_write_port_1_w },    /* Wiz only */
  169.     { 0x7000, 0x7000, interrupt_enable_w },        /* Wiz */
  170.     { -1 }  /* end of table */
  171. };
  172.  
  173.  
  174.  
  175. INPUT_PORTS_START( wiz )
  176.     PORT_START      /* IN1 */
  177.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
  178.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL )
  179.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 )
  180.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START2 )
  181.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_START1 )
  182.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN2 )
  183.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2 )
  184.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON2 | IPF_COCKTAIL )
  185.  
  186.     PORT_START      /* IN2 */
  187.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  188.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_8WAY )
  189.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_8WAY )
  190.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN | IPF_8WAY )
  191.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  192.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL )
  193.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )
  194.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )
  195.  
  196.     PORT_START      /* DSW 0 */
  197.     PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coin_A ) )
  198.     PORT_DIPSETTING(    0x07, DEF_STR( 5C_1C ) )
  199.     PORT_DIPSETTING(    0x03, DEF_STR( 4C_1C ) )
  200.     PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) )
  201.     PORT_DIPSETTING(    0x01, DEF_STR( 2C_1C ) )
  202.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  203.     PORT_DIPSETTING(    0x04, DEF_STR( 1C_2C ) )
  204.     PORT_DIPSETTING(    0x02, DEF_STR( 1C_3C ) )
  205.     PORT_DIPSETTING(    0x06, DEF_STR( 1C_5C ) )
  206.     PORT_DIPNAME( 0x18, 0x00, DEF_STR( Coin_B ) )
  207.     PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
  208.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  209.     PORT_DIPSETTING(    0x18, DEF_STR( 2C_3C ) )
  210.     PORT_DIPSETTING(    0x10, DEF_STR( 1C_2C ) )
  211.     PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
  212.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  213.     PORT_DIPSETTING(    0x20, DEF_STR( On ) )
  214.     PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
  215.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  216.     PORT_DIPSETTING(    0x40, DEF_STR( On ) )
  217.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Free_Play ) )
  218.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  219.     PORT_DIPSETTING(    0x80, DEF_STR( On ) )
  220.  
  221.     PORT_START      /* DSW 1 */
  222.     PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
  223.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  224.     PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
  225.     PORT_DIPNAME( 0x06, 0x00, DEF_STR( Difficulty ) )
  226.     PORT_DIPSETTING(    0x00, "1" )
  227.     PORT_DIPSETTING(    0x02, "2" )
  228.     PORT_DIPSETTING(    0x04, "3" )
  229.     PORT_DIPSETTING(    0x06, "4" )
  230.     PORT_DIPNAME( 0x18, 0x10, DEF_STR( Lives ) )
  231.     PORT_DIPSETTING(    0x08, "1" )
  232.     PORT_DIPSETTING(    0x10, "3" )
  233.     PORT_DIPSETTING(    0x18, "5" )
  234.     PORT_BITX( 0,       0x00, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "255", IP_KEY_NONE, IP_JOY_NONE )
  235.     PORT_DIPNAME( 0x60, 0x00, DEF_STR( Bonus_Life ) )
  236.     PORT_DIPSETTING(    0x00, "10000 30000" )
  237.     PORT_DIPSETTING(    0x20, "20000 40000" )
  238.     PORT_DIPSETTING(    0x40, "30000 60000" )
  239.     PORT_DIPSETTING(    0x60, "40000 80000" )
  240.     PORT_SERVICE( 0x80, IP_ACTIVE_HIGH )
  241. INPUT_PORTS_END
  242.  
  243. INPUT_PORTS_START( stinger )
  244.     PORT_START    /* IN0 */
  245.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
  246.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 | IPF_COCKTAIL )
  247.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2 )
  248.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START2 )
  249.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_START1 )
  250.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN2 )
  251.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1 )
  252.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL )
  253.  
  254.     PORT_START    /* IN1 */
  255.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  256.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_8WAY )
  257.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL )
  258.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  259.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_8WAY )
  260.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN | IPF_8WAY )
  261.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )
  262.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )
  263.  
  264.     PORT_START    /* DSW0 */
  265.     PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) )
  266.     PORT_DIPSETTING(    0x01, DEF_STR( 4C_1C ) )
  267.     PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
  268.     PORT_DIPSETTING(    0x04, DEF_STR( 2C_1C ) )
  269.     PORT_DIPSETTING(    0x00, DEF_STR( 3C_2C ) )
  270.     PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
  271.     PORT_DIPSETTING(    0x03, DEF_STR( 2C_3C ) )
  272.     PORT_DIPSETTING(    0x06, DEF_STR( 1C_2C ) )
  273.     PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) )
  274.     PORT_DIPNAME( 0x18, 0x08, DEF_STR( Lives ) )
  275.     PORT_DIPSETTING(    0x00, "2" )
  276.     PORT_DIPSETTING(    0x08, "3" )
  277.     PORT_DIPSETTING(    0x10, "4" )
  278.     PORT_DIPSETTING(    0x18, "5" )
  279.     PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Bonus_Life ) )
  280.     PORT_DIPSETTING(    0xe0, "20000 50000" )
  281.     PORT_DIPSETTING(    0xc0, "20000 60000" )
  282.     PORT_DIPSETTING(    0xa0, "20000 70000" )
  283.     PORT_DIPSETTING(    0x80, "20000 80000" )
  284.     PORT_DIPSETTING(    0x60, "20000 90000" )
  285.     PORT_DIPSETTING(    0x40, "30000 80000" )
  286.     PORT_DIPSETTING(    0x20, "30000 90000" )
  287.     PORT_DIPSETTING(    0x00, "None" )
  288.  
  289.     PORT_START    /* DSW1 */
  290.     PORT_DIPNAME( 0x01, 0x00, DEF_STR( Free_Play ) )
  291.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  292.     PORT_DIPSETTING(    0x01, DEF_STR( On ) )
  293.     PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) )      // Doesn't seem to be referenced
  294.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  295.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  296.     PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) )    // Doesn't seem to be referenced
  297.     PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
  298.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  299.     PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )    // Doesn't seem to be referenced
  300.     PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
  301.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  302.     PORT_DIPNAME( 0x70, 0x70, DEF_STR( Coin_B ) )
  303.     PORT_DIPSETTING(    0x70, DEF_STR( 1C_1C ) )
  304.     PORT_DIPSETTING(    0x60, DEF_STR( 1C_2C ) )
  305.     PORT_DIPSETTING(    0x50, DEF_STR( 1C_3C ) )
  306.     PORT_DIPSETTING(    0x40, DEF_STR( 1C_4C ) )
  307.     PORT_DIPSETTING(    0x30, DEF_STR( 1C_5C ) )
  308.     PORT_DIPSETTING(    0x20, DEF_STR( 1C_6C ) )
  309.     PORT_DIPSETTING(    0x10, DEF_STR( 1C_7C ) )
  310.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_8C ) )
  311.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Cabinet ) )
  312.     PORT_DIPSETTING(    0x80, DEF_STR( Upright ) )
  313.     PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
  314. INPUT_PORTS_END
  315.  
  316. INPUT_PORTS_START( scion )
  317.     PORT_START    /* IN0 */
  318.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
  319.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 | IPF_COCKTAIL )
  320.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2 )
  321.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START2 )
  322.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_START1 )
  323.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN2 )
  324.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1 )
  325.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL )
  326.  
  327.     PORT_START    /* IN1 */
  328.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  329.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_8WAY )
  330.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  331.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )
  332.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_8WAY )
  333.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN | IPF_8WAY )
  334.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL )
  335.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )
  336.  
  337.     PORT_START    /* DSW0 */
  338.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Cabinet ) )
  339.     PORT_DIPSETTING(    0x01, DEF_STR( Upright ) )
  340.     PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
  341.     PORT_DIPNAME( 0x02, 0x00, DEF_STR( Difficulty ) )
  342.     PORT_DIPSETTING(    0x00, "Easy" )
  343.     PORT_DIPSETTING(    0x02, "Hard" )
  344.     PORT_DIPNAME( 0x0c, 0x04, DEF_STR( Lives ) )
  345.     PORT_DIPSETTING(    0x00, "2" )
  346.     PORT_DIPSETTING(    0x04, "3" )
  347.     PORT_DIPSETTING(    0x08, "4" )
  348.     PORT_DIPSETTING(    0x0c, "5" )
  349.     PORT_DIPNAME( 0x30, 0x00, DEF_STR( Bonus_Life ) )
  350.     PORT_DIPSETTING(    0x00, "20000 40000" )
  351.     PORT_DIPSETTING(    0x20, "20000 60000" )
  352.     PORT_DIPSETTING(    0x10, "20000 80000" )
  353.     PORT_DIPSETTING(    0x30, "30000 90000" )
  354.     PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )    // Doesn't seem to be referenced
  355.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  356.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  357.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) )    // Doesn't seem to be referenced
  358.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  359.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  360.  
  361.     PORT_START    /* DSW1 */
  362.     PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coin_A ) )
  363.     PORT_DIPSETTING(    0x07, DEF_STR( 5C_1C ) )
  364.     PORT_DIPSETTING(    0x03, DEF_STR( 4C_1C ) )
  365.     PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) )
  366.     PORT_DIPSETTING(    0x01, DEF_STR( 2C_1C ) )
  367.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  368.     PORT_DIPSETTING(    0x04, DEF_STR( 1C_2C ) )
  369.     PORT_DIPSETTING(    0x02, DEF_STR( 1C_3C ) )
  370.     PORT_DIPSETTING(    0x06, DEF_STR( 1C_5C ) )
  371.     PORT_DIPNAME( 0x18, 0x00, DEF_STR( Coin_B ) )
  372.     PORT_DIPSETTING(    0x18, DEF_STR( 3C_1C ) )
  373.     PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
  374.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  375.     PORT_DIPSETTING(    0x10, DEF_STR( 1C_2C ) )
  376.     PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
  377.   //PORT_DIPSETTING(    0x20, DEF_STR( Off ) )  /* This setting will screw up the game */
  378.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  379.     PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
  380.   //PORT_DIPSETTING(    0x40, DEF_STR( Off ) )  /* This setting will screw up the game */
  381.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  382.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) )
  383.   //PORT_DIPSETTING(    0x80, DEF_STR( Off ) )  /* This setting will screw up the game */
  384.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  385. INPUT_PORTS_END
  386.  
  387.  
  388. static struct GfxLayout charlayout =
  389. {
  390.     8,8,    /* 8*8 characters */
  391.     256,    /* 256 characters */
  392.     3,      /* 3 bits per pixel */
  393.     { 0x4000*8, 0x2000*8, 0 }, /* the three bitplanes are separated */
  394.     { 0, 1, 2, 3, 4, 5, 6, 7 },
  395.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  396.     8*8     /* every char takes 8 consecutive bytes */
  397. };
  398.  
  399.  
  400. static struct GfxLayout spritelayout =
  401. {
  402.     16,16,  /* 16*16 sprites */
  403.     256,    /* 256 sprites */
  404.     3,      /* 3 bits per pixel */
  405.     { 0x4000*8, 0x2000*8, 0 }, /* the three bitplanes are separated */
  406.     { 0, 1, 2, 3, 4, 5, 6, 7,
  407.      8*8+0, 8*8+1, 8*8+2, 8*8+3, 8*8+4, 8*8+5, 8*8+6, 8*8+7 },
  408.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  409.       16*8, 17*8, 18*8, 19*8, 20*8, 21*8, 22*8, 23*8 },
  410.     32*8     /* every sprite takes 32 consecutive bytes */
  411. };
  412.  
  413.  
  414. // I don't know how the 32 colors are used. I'm making the
  415. // forest and the title screen green/brown, and the ice and sky levels
  416. // white/blue. What we need is screenshots.
  417. static struct GfxDecodeInfo wiz_gfxdecodeinfo[] =
  418. {
  419.     { REGION_GFX1, 0x0000, &charlayout,   0, 32 },
  420.     { REGION_GFX1, 0x0800, &charlayout,   0, 32 },
  421.     { REGION_GFX2, 0x6000, &charlayout,   0, 32 },
  422.     { REGION_GFX2, 0x0000, &charlayout,   0, 32 },
  423.     { REGION_GFX2, 0x0800, &charlayout,   0, 32 },
  424.     { REGION_GFX2, 0x6800, &charlayout,   0, 32 },
  425.     { REGION_GFX1, 0x0000, &spritelayout, 0, 32 },
  426.     { REGION_GFX2, 0x0000, &spritelayout, 0, 32 },
  427.     { REGION_GFX2, 0x6000, &spritelayout, 0, 32 },
  428.     { -1 } /* end of array */
  429. };
  430.  
  431. static struct GfxDecodeInfo stinger_gfxdecodeinfo[] =
  432. {
  433.     { REGION_GFX1, 0x0000, &charlayout,   0, 32 },
  434.     { REGION_GFX1, 0x0800, &charlayout,   0, 32 },
  435.     { REGION_GFX2, 0x0000, &charlayout,   0, 32 },
  436.     { REGION_GFX2, 0x0800, &charlayout,   0, 32 },
  437.     { REGION_GFX1, 0x0000, &spritelayout, 0, 32 },
  438.     { REGION_GFX2, 0x0000, &spritelayout, 0, 32 },
  439.     { -1 } /* end of array */
  440. };
  441.  
  442.  
  443. static struct AY8910interface wiz_ay8910_interface =
  444. {
  445.     3,      /* 3 chips */
  446.     14318000/8,    /* ? */
  447.     { 10, 10, 10 },
  448.     { 0 },
  449.     { 0 },
  450.     { 0 },
  451.     { 0 }
  452. };
  453.  
  454. static struct AY8910interface stinger_ay8910_interface =
  455. {
  456.     2,      /* 2 chips */
  457.     14318000/8,    /* ? */
  458.     { 25, 25 },
  459.     { 0 },
  460.     { 0 },
  461.     { 0 },
  462.     { 0 }
  463. };
  464.  
  465.  
  466. #define MACHINE_DRIVER(NAME)                                    \
  467. static struct MachineDriver machine_driver_##NAME =                \
  468. {                                                                \
  469.     {                                                            \
  470.         {                                                        \
  471.             CPU_Z80,                                            \
  472.             18432000/6,     /* 3.072 Mhz ??? */                    \
  473.             readmem,writemem,0,0,                                \
  474.             nmi_interrupt,1                                        \
  475.         },                                                        \
  476.         {                                                        \
  477.             CPU_Z80 | CPU_AUDIO_CPU,                            \
  478.             14318000/8,     /* ? */                                \
  479.             sound_readmem,sound_writemem,0,0,                    \
  480.             nmi_interrupt,3 /* ??? */                            \
  481.         }                                                        \
  482.     },                                                            \
  483.     60, DEFAULT_REAL_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */            \
  484.     1,    /* 1 CPU slice per frame - interleaving is forced when a sound command is written */    \
  485.     0,                                                            \
  486.                                                                 \
  487.     /* video hardware */                                        \
  488.     32*8, 32*8, { 0*8, 32*8-1, 2*8, 30*8-1 },                    \
  489.     NAME##_gfxdecodeinfo,                                        \
  490.     256,32*8,                                                    \
  491.     wiz_vh_convert_color_prom,                                    \
  492.                                                                 \
  493.     VIDEO_TYPE_RASTER,                                            \
  494.     0,                                                            \
  495.     generic_vh_start,                                            \
  496.     generic_vh_stop,                                            \
  497.     NAME##_vh_screenrefresh,                                    \
  498.                                                                 \
  499.     /* sound hardware */                                        \
  500.     0,0,0,0,                                                    \
  501.     {                                                            \
  502.         {                                                        \
  503.             SOUND_AY8910,                                        \
  504.             &NAME##_ay8910_interface                            \
  505.         }                                                        \
  506.     }                                                            \
  507. }
  508.  
  509. MACHINE_DRIVER(wiz);
  510. MACHINE_DRIVER(stinger);
  511.  
  512.  
  513. /***************************************************************************
  514.  
  515.   Game driver(s)
  516.  
  517. ***************************************************************************/
  518.  
  519. ROM_START( wiz )
  520.     ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code */
  521.     ROM_LOAD( "ic07_01.bin",  0x0000, 0x4000, 0xc05f2c78 )
  522.     ROM_LOAD( "ic05_03.bin",  0x4000, 0x4000, 0x7978d879 )
  523.     ROM_LOAD( "ic06_02.bin",  0x8000, 0x4000, 0x9c406ad2 )
  524.  
  525.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the audio CPU */
  526.     ROM_LOAD( "ic57_10.bin",  0x0000, 0x2000, 0x8a7575bd )
  527.  
  528.     ROM_REGION( 0x6000,  REGION_GFX1 | REGIONFLAG_DISPOSE )    /* sprites/chars */
  529.     ROM_LOAD( "ic12_04.bin",  0x0000, 0x2000, 0x8969acdd )
  530.     ROM_LOAD( "ic13_05.bin",  0x2000, 0x2000, 0x2868e6a5 )
  531.     ROM_LOAD( "ic14_06.bin",  0x4000, 0x2000, 0xb398e142 )
  532.  
  533.     ROM_REGION( 0xc000,  REGION_GFX2 | REGIONFLAG_DISPOSE )    /* sprites/chars */
  534.     ROM_LOAD( "ic03_07.bin",  0x0000, 0x2000, 0x297c02fc )
  535.     ROM_CONTINUE(              0x6000, 0x2000  )
  536.     ROM_LOAD( "ic02_08.bin",  0x2000, 0x2000, 0xede77d37 )
  537.     ROM_CONTINUE(              0x8000, 0x2000  )
  538.     ROM_LOAD( "ic01_09.bin",  0x4000, 0x2000, 0x4d86b041 )
  539.     ROM_CONTINUE(              0xa000, 0x2000  )
  540.  
  541.     ROM_REGION( 0x0300, REGION_PROMS )
  542.     ROM_LOAD( "ic23_3-1.bin", 0x0000, 0x0100, 0x2dd52fb2 ) /* palette red component */
  543.     ROM_LOAD( "ic23_3-2.bin", 0x0100, 0x0100, 0x8c2880c9 ) /* palette green component */
  544.     ROM_LOAD( "ic23_3-3.bin", 0x0200, 0x0100, 0xa488d761 ) /* palette blue component */
  545. ROM_END
  546.  
  547. ROM_START( wizt )
  548.     ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code */
  549.     ROM_LOAD( "wiz1.bin",        0x0000, 0x4000, 0x5a6d3c60 )
  550.     ROM_LOAD( "ic05_03.bin",  0x4000, 0x4000, 0x7978d879 )
  551.     ROM_LOAD( "ic06_02.bin",  0x8000, 0x4000, 0x9c406ad2 )
  552.  
  553.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the audio CPU */
  554.     ROM_LOAD( "ic57_10.bin",  0x0000, 0x2000, 0x8a7575bd )
  555.  
  556.     ROM_REGION( 0x6000,  REGION_GFX1 | REGIONFLAG_DISPOSE )    /* sprites/chars */
  557.     ROM_LOAD( "wiz4.bin",     0x0000, 0x2000, 0xe6c636b3 )
  558.     ROM_LOAD( "wiz5.bin",     0x2000, 0x2000, 0x77986058 )
  559.     ROM_LOAD( "wiz6.bin",     0x4000, 0x2000, 0xf6970b23 )
  560.  
  561.     ROM_REGION( 0xc000,  REGION_GFX2 | REGIONFLAG_DISPOSE )    /* sprites/chars */
  562.     ROM_LOAD( "wiz7.bin",     0x0000, 0x2000, 0x601f2f3f )
  563.     ROM_CONTINUE(              0x6000, 0x2000  )
  564.     ROM_LOAD( "wiz8.bin",     0x2000, 0x2000, 0xf5ab982d )
  565.     ROM_CONTINUE(              0x8000, 0x2000  )
  566.     ROM_LOAD( "wiz9.bin",     0x4000, 0x2000, 0xf6c662e2 )
  567.     ROM_CONTINUE(              0xa000, 0x2000  )
  568.  
  569.     ROM_REGION( 0x0300, REGION_PROMS )
  570.     ROM_LOAD( "ic23_3-1.bin", 0x0000, 0x0100, 0x2dd52fb2 ) /* palette red component */
  571.     ROM_LOAD( "ic23_3-2.bin", 0x0100, 0x0100, 0x8c2880c9 ) /* palette green component */
  572.     ROM_LOAD( "ic23_3-3.bin", 0x0200, 0x0100, 0xa488d761 ) /* palette blue component */
  573. ROM_END
  574.  
  575. ROM_START( stinger )
  576.     ROM_REGION( 2*0x10000, REGION_CPU1 )    /* 64k for code + 64k for decrypted opcodes */
  577.     ROM_LOAD( "n1.bin",       0x0000, 0x2000, 0xf2d2790c )    /* encrypted */
  578.     ROM_LOAD( "n2.bin",       0x2000, 0x2000, 0x8fd2d8d8 )    /* encrypted */
  579.     ROM_LOAD( "n3.bin",       0x4000, 0x2000, 0xf1794d36 )    /* encrypted */
  580.     ROM_LOAD( "n4.bin",       0x6000, 0x2000, 0x230ba682 )    /* encrypted */
  581.     ROM_LOAD( "n5.bin",       0x8000, 0x2000, 0xa03a01da )    /* encrypted */
  582.  
  583.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for sound cpu */
  584.     ROM_LOAD( "6.bin",        0x0000, 0x2000, 0x79757f0c )
  585.  
  586.     ROM_REGION( 0x6000,  REGION_GFX1 | REGIONFLAG_DISPOSE )    /* sprites/chars */
  587.     ROM_LOAD( "7.bin",        0x0000, 0x2000, 0x775489be )
  588.     ROM_LOAD( "8.bin",        0x2000, 0x2000, 0x43c61b3f )
  589.     ROM_LOAD( "9.bin",        0x4000, 0x2000, 0xc9ed8fc7 )
  590.  
  591.     ROM_REGION( 0x6000,  REGION_GFX2 | REGIONFLAG_DISPOSE )    /* sprites/chars */
  592.     ROM_LOAD( "10.bin",       0x0000, 0x2000, 0xf6721930 )
  593.     ROM_LOAD( "11.bin",       0x2000, 0x2000, 0xa4404e63 )
  594.     ROM_LOAD( "12.bin",       0x4000, 0x2000, 0xb60fa88c )
  595.  
  596.     ROM_REGION( 0x0300,  REGION_PROMS )
  597.     ROM_LOAD( "stinger.a7",   0x0000, 0x0100, 0x52c06fc2 )    /* red component */
  598.     ROM_LOAD( "stinger.b7",   0x0100, 0x0100, 0x9985e575 )    /* green component */
  599.     ROM_LOAD( "stinger.a8",   0x0200, 0x0100, 0x76b57629 )    /* blue component */
  600. ROM_END
  601.  
  602. ROM_START( scion )
  603.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  604.     ROM_LOAD( "sc1",          0x0000, 0x2000, 0x8dcad575 )
  605.     ROM_LOAD( "sc2",          0x2000, 0x2000, 0xf608e0ba )
  606.     ROM_LOAD( "sc3",          0x4000, 0x2000, 0x915289b9 )
  607.     ROM_LOAD( "4.9j",         0x6000, 0x2000, 0x0f40d002 )
  608.     ROM_LOAD( "5.10j",        0x8000, 0x2000, 0xdc4923b7 )
  609.  
  610.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for sound cpu */
  611.     ROM_LOAD( "sc6",         0x0000, 0x2000, 0x09f5f9c1 )
  612.  
  613.     ROM_REGION( 0x6000,  REGION_GFX1 | REGIONFLAG_DISPOSE )    /* sprites/chars */
  614.     ROM_LOAD( "7.10e",        0x0000, 0x2000, 0x223e0d2a )
  615.     ROM_LOAD( "8.12e",        0x2000, 0x2000, 0xd3e39b48 )
  616.     ROM_LOAD( "9.15e",        0x4000, 0x2000, 0x630861b5 )
  617.  
  618.     ROM_REGION( 0x6000,  REGION_GFX2 | REGIONFLAG_DISPOSE )    /* sprites/chars */
  619.     ROM_LOAD( "10.10h",       0x0000, 0x2000, 0x0d2a0d1e )
  620.     ROM_LOAD( "11.12h",       0x2000, 0x2000, 0xdc6ef8ab )
  621.     ROM_LOAD( "12.15h",       0x4000, 0x2000, 0xc82c28bf )
  622.  
  623.     ROM_REGION( 0x0300,  REGION_PROMS )
  624.     ROM_LOAD( "82s129.7a",    0x0000, 0x0100, 0x2f89d9ea )    /* red component */
  625.     ROM_LOAD( "82s129.7b",    0x0100, 0x0100, 0xba151e6a )    /* green component */
  626.     ROM_LOAD( "82s129.8a",    0x0200, 0x0100, 0xf681ce59 )    /* blue component */
  627. ROM_END
  628.  
  629. ROM_START( scionc )
  630.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  631.     ROM_LOAD( "1.5j",         0x0000, 0x2000, 0x5aaf571e )
  632.     ROM_LOAD( "2.6j",         0x2000, 0x2000, 0xd5a66ac9 )
  633.     ROM_LOAD( "3.8j",         0x4000, 0x2000, 0x6e616f28 )
  634.     ROM_LOAD( "4.9j",         0x6000, 0x2000, 0x0f40d002 )
  635.     ROM_LOAD( "5.10j",        0x8000, 0x2000, 0xdc4923b7 )
  636.  
  637.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for sound cpu */
  638.     ROM_LOAD( "6.9f",         0x0000, 0x2000, 0xa66a0ce6 )
  639.  
  640.     ROM_REGION( 0x6000,  REGION_GFX1 | REGIONFLAG_DISPOSE )    /* sprites/chars */
  641.     ROM_LOAD( "7.10e",        0x0000, 0x2000, 0x223e0d2a )
  642.     ROM_LOAD( "8.12e",        0x2000, 0x2000, 0xd3e39b48 )
  643.     ROM_LOAD( "9.15e",        0x4000, 0x2000, 0x630861b5 )
  644.  
  645.     ROM_REGION( 0x6000,  REGION_GFX2 | REGIONFLAG_DISPOSE )    /* sprites/chars */
  646.     ROM_LOAD( "10.10h",       0x0000, 0x2000, 0x0d2a0d1e )
  647.     ROM_LOAD( "11.12h",       0x2000, 0x2000, 0xdc6ef8ab )
  648.     ROM_LOAD( "12.15h",       0x4000, 0x2000, 0xc82c28bf )
  649.  
  650.     ROM_REGION( 0x0300,  REGION_PROMS )
  651.     ROM_LOAD( "82s129.7a",    0x0000, 0x0100, 0x2f89d9ea )    /* red component */
  652.     ROM_LOAD( "82s129.7b",    0x0100, 0x0100, 0xba151e6a )    /* green component */
  653.     ROM_LOAD( "82s129.8a",    0x0200, 0x0100, 0xf681ce59 )    /* blue component */
  654. ROM_END
  655.  
  656.  
  657.  
  658. static void init_stinger(void)
  659. {
  660.     static const unsigned char xortable[4][4] =
  661.     {
  662.         { 0xa0,0x88,0x88,0xa0 },    /* .........00.0... */
  663.         { 0x88,0x00,0xa0,0x28 },    /* .........00.1... */
  664.         { 0x80,0xa8,0x20,0x08 },    /* .........01.0... */
  665.         { 0x28,0x28,0x88,0x88 }        /* .........01.1... */
  666.     };
  667.     unsigned char *rom = memory_region(REGION_CPU1);
  668.     int diff = memory_region_length(REGION_CPU1) / 2;
  669.     int A;
  670.  
  671.  
  672.     memory_set_opcode_base(0,rom+diff);
  673.  
  674.     for (A = 0x0000;A < 0x10000;A++)
  675.     {
  676.         int row,col;
  677.         unsigned char src;
  678.  
  679.  
  680.         if (A & 0x2040)
  681.         {
  682.             /* not encrypted */
  683.             rom[A+diff] = rom[A];
  684.         }
  685.         else
  686.         {
  687.             src = rom[A];
  688.  
  689.             /* pick the translation table from bits 3 and 5 */
  690.             row = ((A >> 3) & 1) + (((A >> 5) & 1) << 1);
  691.  
  692.             /* pick the offset in the table from bits 3 and 5 of the source data */
  693.             col = ((src >> 3) & 1) + (((src >> 5) & 1) << 1);
  694.             /* the bottom half of the translation table is the mirror image of the top */
  695.             if (src & 0x80) col = 3 - col;
  696.  
  697.             /* decode the opcodes */
  698.             rom[A+diff] = src ^ xortable[row][col];
  699.         }
  700.     }
  701. }
  702.  
  703.  
  704.  
  705. GAMEX( 1983, stinger, 0,     stinger, stinger, stinger, ROT90,  "Seibu Denshi", "Stinger",     GAME_IMPERFECT_COLORS )
  706. GAMEX( 1984, scion,   0,     stinger, scion,   0,       ROT0,   "Seibu Denshi", "Scion",       GAME_IMPERFECT_COLORS )
  707. GAMEX( 1984, scionc,  scion, stinger, scion,   0,       ROT0,   "Seibu Denshi [Cinematronics license]", "Scion (Cinematronics)", GAME_IMPERFECT_COLORS )
  708. GAMEX( 1985, wiz,     0,     wiz,     wiz,     0,       ROT270, "Seibu Kaihatsu Inc.", "Wiz",  GAME_IMPERFECT_COLORS )
  709. GAMEX( 1985, wizt,    wiz,   wiz,     wiz,     0,       ROT270, "Taito Corp.",  "Wiz (Taito)", GAME_IMPERFECT_COLORS )
  710.